package com.jiazhong.jdbc.spring.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

/**
 * @Auther:shuXin
 */
@Repository
public class CheckoutServiceImpl implements CheckoutService {

    @Autowired
    private UserService userService;

    @Override
    public void checkout(Integer[] bookIds, Integer userId) {
        //买多本书的操作
        for (Integer bookId : bookIds) {
            System.out.println(bookId);
            userService.buyBook(bookId, userId);
        }
    }
}
